# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgname=country-ip-blocks
pkgver=5689.b46ce3c
pkgrel=1
pkgdesc='CIDR country-level IP data, straight from the Regional Internet Registries, updated hourly.'
arch=('any')
groups=('blackarch' 'blackarch-wordlist' 'blackarch-misc')
url='https://github.com/herrbischoff/country-ip-blocks'
license=('CC0-1.0')
depends=()
makedepends=('git')
source=("git+https://github.com/herrbischoff/$pkgname.git")
sha512sums=('SKIP')

pkgver() {
  cd $pkgname

  ( set -o pipefail
    git describe --long --tags --abbrev=7 2>/dev/null |
      sed 's/\([^-]*-g\)/r\1/;s/-/./g' ||
    printf "%s.%s" "$(git rev-list --count HEAD)" \
      "$(git rev-parse --short=7 HEAD)"
  )
}

package() {
  cd $pkgname

  install -dm 755 "$pkgdir/usr/share/$pkgname"

  install -Dm 644 -t "$pkgdir/usr/share/doc/$pkgname/" README.md
  install -Dm 644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"

  rm -f LICENSE README.md

  cp -a * "$pkgdir/usr/share/$pkgname/"
}

